package com.qq.lht.androidgame24;

import android.graphics.Bitmap;

public class Coin extends Sprite {
    private boolean isDead;
    private int count;  //图片帧数
    private int delay;

    public boolean isDead() {
        return isDead;
    }

    public void setDead(boolean dead) {
        isDead = dead;
    }

    public Coin(Bitmap bitmap, int width, int height) {
        super(bitmap, width, height);
    }

    @Override
    public void logic() {
        if (isDead){
            setVisible(true);
        }else {
            if (delay++==1){  //设置延迟方便真机调试
                delay=0;
                if (count<6){
                    move(getSpeedX(),getSpeedY());
                    nextFrame();
                }
            }else {
                move(-getSpeedX(),-getSpeedY());
                nextFrame();
            }
        }
    }
}
